home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok15.lha
/
Seafarers_Manual
/
Source
/
Main.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
751b
|
38 lines
MODULE Main; (* Demonstrate use of duplicate identifiers *)
(* From the book "Modula-2 A Seafarer's Manual and Shipyard Guide" *)
(* Page 105 adapted "Amiga M2Modula-2" 08 Mar 1988 *)
FROM InOut IMPORT WriteLn,
WriteString,
WriteInt;
VAR
i : INTEGER;
PROCEDURE DisplayLocali;
VAR
i : INTEGER;
BEGIN
i := 2; (* effects i only within this procedure *)
WriteString ("local i = ");
WriteInt (i,5);
END DisplayLocali;
BEGIN
i := 1;
WriteLn;
WriteString ("before procedure call, main i = ");
WriteInt (i,5);
WriteLn;
DisplayLocali; (* call procedure *)
WriteLn;
WriteString ("after procedure call, main i = ");
WriteInt (i,5);
WriteLn;
END Main.